﻿using System;

namespace Ayatta.Contract.Domain
{
    public class Shipment : BaseEntity<string>
    {
        public byte Category { get; set; }

        /// <summary>
        /// 订单Id
        /// </summary>
        public string OrderId { get; set; }

        /// <summary>
        /// 子订单Id（多个以','连接）
        /// </summary>
        public string OrderItemId { get; set; }

        /// <summary>
        /// 运单号
        /// </summary>
        public string ExpressNo { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Summary { get; set; }

        /// <summary>
        /// 是否快捷COD订单
        /// </summary>
        public bool IsQuickCod { get; set; }

        /// <summary>
        /// 预约取货开始时间
        /// </summary>
        public DateTime? DeliveryStart { get; set; }

        /// <summary>
        /// 预约取货结束时间
        /// </summary>
        public DateTime? DeliveryEnd { get; set; }

        /// <summary>
        /// 谁承担运费.可选值:buyer(买家承担),seller(卖家承担运费)
        /// </summary>
        public string Payer { get; set; }

        /// <summary>
        /// 收货人姓名
        /// </summary>
        public string Receiver { get; set; }

        /// <summary>
        /// 收货人公司
        /// </summary>
        public string Company { get; set; }

        /// <summary>
        /// 收货人固定电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 收货人移动电话
        /// </summary>
        public string Mobile { get; set; }

        /// <summary>
        /// 收货人所在省市区Id
        /// </summary>
        public string AreaId { get; set; }

        /// <summary>
        /// 收货人所在省
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 收货人所在市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 收货人所在区
        /// </summary>
        public string District { get; set; }

        /// <summary>
        /// 收货人详细地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 邮政编码
        /// </summary>
        public string PostalCode { get; set; }

        /// <summary>
        /// 物流公司Id
        /// </summary>
        public int CompanyId { get; set; }

        /// <summary>
        /// 物流公司名称
        /// </summary>
        public string CompanyName { get; set; }

        /// <summary>
        /// 发货人Id
        /// </summary>
        public int SenderId { get; set; }

        /// <summary>
        /// 收货人Id
        /// </summary>
        public int ReceiverId { get; set; }

        /// <summary>
        /// 收货人用户名
        /// </summary>
        public string ReceiverName { get; set; }

        /// <summary>
        /// 是否为在线下单
        /// </summary>
        public bool IsOnline { get; set; }

        /// <summary>
        /// 扩展信息
        /// </summary>
        public string Extra { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public ShippingStatus Status { get; set; }

        /// <summary>
        /// 发货/退货信息
        /// </summary>
        public virtual ShipmentExtra ShipmentExtra { get; set; }

    }

    public class ShipmentExtra : IEntity<string>
    {
        /// <summary>
        /// ShippingId
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 发货人姓名
        /// </summary>
        public string Sender { get; set; }

        /// <summary>
        /// 发货人公司
        /// </summary>
        public string Company { get; set; }

        /// <summary>
        /// 发货人固定电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 发货人移动电话
        /// </summary>
        public string Mobile { get; set; }

        /// <summary>
        /// 发货人所在省市区Id
        /// </summary>
        public string AreaId { get; set; }

        /// <summary>
        /// 发货人所在省
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 发货人所在市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 发货人所在区
        /// </summary>
        public string District { get; set; }

        /// <summary>
        /// 发货人详细地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 邮政编码
        /// </summary>
        public string PostalCode { get; set; }

        /// <summary>
        /// 退货接收人姓名
        /// </summary>
        public string Receiver { get; set; }

        /// <summary>
        /// 退货接收人公司
        /// </summary>
        public string ReceiverCompany { get; set; }

        /// <summary>
        /// 退货接收人固定电话
        /// </summary>
        public string ReceiverPhone { get; set; }

        /// <summary>
        /// 退货接收人移动电话
        /// </summary>
        public string ReceiverMobile { get; set; }

        /// <summary>
        /// 退货接收人所在省市区Id
        /// </summary>
        public string ReceiverAreaId { get; set; }

        /// <summary>
        /// 退货接收人所在省
        /// </summary>
        public string ReceiverProvince { get; set; }

        /// <summary>
        /// 退货接收人所在市
        /// </summary>
        public string ReceiverCity { get; set; }

        /// <summary>
        /// 退货接收人所在省区
        /// </summary>
        public string ReceiverDistrict { get; set; }

        /// <summary>
        /// 退货接收人详细地址
        /// </summary>
        public string ReceiverAddress { get; set; }

        /// <summary>
        /// 退货接收人邮政编码
        /// </summary>
        public string ReceiverPostalCode { get; set; }

    }

    /// <summary>
    /// 发货状态
    /// </summary>
    public enum ShippingStatus : byte
    {
        /// <summary>
        /// 订单已创建
        /// </summary>
        Created = 0,

        /// <summary>
        /// 订单重新创建
        /// </summary>
        ReCreated = 1,

        /// <summary>
        /// 已取消
        /// </summary>
        Cancelled = 2,

        /// <summary>
        /// 订单关闭
        /// </summary>
        Closed = 3,

        /// <summary>
        /// 等候发送给物流公司
        /// </summary>
        Sending = 4,

        /// <summary>
        /// 已发送给物流公司,等待接单
        /// </summary>
        Accepting = 5,

        /// <summary>
        /// 物流公司已接单
        /// </summary>
        Accepted = 6,

        /// <summary>
        /// 物流公司不接单
        /// </summary>
        Rejected = 7,

        /// <summary>
        /// 物流公司揽收成功
        /// </summary>
        PickUp = 8,

        /// <summary>
        /// 物流公司揽收失败
        /// </summary>
        PickUpFailed = 9,

        /// <summary>
        /// 物流公司丢单
        /// </summary>
        Lost = 10,

        /// <summary>
        /// 对方拒签
        /// </summary>
        RejectedByReceiver = 11,

        /// <summary>
        /// 发货方式在线下单：对方已签收；自己联系：卖家已发货
        /// </summary>
        AcceptedByReceiver = 12
    }

}